package cqrtplm.enums;

import com.google.common.collect.Lists;

import java.util.List;
import java.util.Objects;

/**
 * 图样代号绑定规则枚举
 */
public enum DrawingEnums {

    CAD("2D","ZWCAD,Drawing,DrawingsCertification,DrawingsOPE,DrawingsCustomer,BlueprintPackagingDecalDWG,UG工程图"),
    CAD_UG("2D/3D","ZWCAD,Drawing,DrawingsCertification,DrawingsOPE,DrawingsCustomer,BlueprintPackagingDecalDWG,UG工程图,UG,3DDataDrawing,3DDataAppearance3D,3DDataAssemblyTool"),
    UG("3D","UG,3DDataDrawing,3DDataAppearance3D,3DDataAssemblyTool"),
    FY("封样","SampleSealingReport"),
    CAD_FY("2D/封样","ZWCAD,Drawing,DrawingsCertification,DrawingsOPE,DrawingsCustomer,BlueprintPackagingDecalDWG,UG工程图,SampleSealingReport"),

    ;

    String code;
    String desc;

    DrawingEnums(String code, String desc) {

        this.code = code;
        this.desc = desc;

    }


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static List<String> getAllType() {
        List<String> typeList = Lists.newArrayList();
        for (DrawingEnums c : DrawingEnums.values()) {
            typeList.add(c.getDesc());
        }
        return typeList;
    }

    public static String getDescByCode(String code) {
        for (DrawingEnums c : DrawingEnums.values()) {
            if (Objects.equals(c.getCode(), code)) {
                return c.getDesc();
            }
        }
        return "此图样代号无对应规则绑定"; // 如果没有匹配到对应的 desc，返回 null 或者其他默认值
    }

}
